<?php
/**
 * FastApp.
 * 8/23/24
 * @Author deepsea159
 * @Contact telegram:deepsea159
 */
declare(strict_types=1);

use Hyperf\Database\Seeders\Seeder;
use Hyperf\DbConnection\Db;

class Config extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        foreach (array_merge([], $this->appData()) as $sql) {
            try {
                Db::connection('default')->insert($sql);
            } catch (\Throwable) {
            }
        }
    }

    public function appData(int $appid = 300001): array
    {
        return [
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('应用域名', $appid, 'app_domain', '');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('应用名称', $appid, 'app_name', '');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('应用logo', $appid, 'app_logo', '');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('应用tg_bot_token', $appid, 'app_tg_bot_token', '');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('支持币种', $appid, 'symbol', 'BRL,TRX');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('代理结算周期(天)', $appid, 'agent_profit_interval', '7');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('提现最小金额', $appid, 'withdrawal_min_amount', '10');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('提现审核开关', $appid, 'withdrawal_check', '1');",
            "INSERT INTO fastapp_app_setting (name, account_type, `key`, val) VALUES('提现审核最小金额', $appid, 'withdrawal_check_amount', '100');"
        ];
    }
}
